home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 17 / CU Amiga Magazine's Super CD-ROM 17 (1997)(EMAP Images)(GB)[!][issue 1997-12].iso / CUCD / Programming / Gui4Cli / Docs / Tutorials / ARexx.gc < prev    next >
Encoding:
Gui4CLI script  |  1980-01-03  |  2.0 KB  |  79 lines

  1. G4C
  2.  
  3. ;  This script assumes that ARexx is available.
  4.  
  5. WINBIG -1 -1 260 90 "ARexx.gc"
  6. WinType 11110001
  7. usetopaz
  8.  
  9. CTEXT 30 0 'Tapping into ARexx' topaz.font 9 2 0 000
  10.  
  11. xonload 
  12. GuiOpen ARexx.gc
  13.  
  14. ; We shall create and then run a small ARexx program.
  15. ; Its job is to create and store, ready for use if and 
  16. ; when they are needed, a small set of Env: variables.
  17.  
  18. gosub ARexx.gc MakeRexx
  19.  
  20. xonClose
  21. ; We clean up afterwards. If you wish to examine the new ARexx
  22. ; program before it is deleted, do so before exiting from this
  23. ; script. Otherwise you'll be too late.
  24.  
  25. ifexists file ram:arx.rexx
  26.     delete ram:arx.rexx
  27. endif
  28. GuiQuit ARexx.gc
  29.  
  30. ; Five buttons to access the information which was stored
  31. ; by the ARexx program.
  32.  
  33. XButton 10 16 120 12 'Date'
  34. update ARexx.gc 1 $.d
  35.  
  36. XButton 10 30 120 12 'Time'
  37. update ARexx.gc 2 $.t
  38.  
  39. XButton 10 44 120 12 'Day'
  40. update ARexx.gc 3 $.w
  41.  
  42. XButton 10 58 120 12 'Month'
  43. update ARexx.gc 4 $.m
  44.  
  45. XButton 10 72 120 12 'Days into year'
  46. update ARexx.gc 5 $.y
  47.  
  48.  
  49. Text 140 16 100 12 '' 20 NOBOX
  50. gadid 1
  51. Text 140 30 100 12 '' 20 NOBOX
  52. gadid 2
  53. Text 140 44 100 12 '' 20 NOBOX
  54. gadid 3
  55. Text 140 58 100 12 '' 20 NOBOX
  56. gadid 4
  57. Text 140 72 100 12 '' 20 NOBOX
  58. gadid 5
  59.  
  60. ; Here, line by line, we build the required ARexx program.
  61. ; When it runs, it obtains date and time details by invoking the
  62. ; relevant forms of ARexx functions, and it stores those details 
  63. ; as Env: variables.
  64. ; The setting of those variables is carried out by invoking a set
  65. ; a AmigaDOS commands. That is done from within the ARexx program by
  66. ; the use of 'address command' plus the details of each setting.
  67.  
  68. xRoutine MakeRexx
  69. .arx = "/*  */"
  70. append Env:.arx "address command 'setenv .d ' || date() \n"
  71. append Env:.arx "address command 'setenv .t ' || time('c') \n"
  72. append Env:.arx "address command 'setenv .w ' || date('w') \n"
  73. append Env:.arx "address command 'setenv .m ' || date('m') \n"
  74. append Env:.arx "address command 'setenv .y ' || date('d') \n"
  75. append Env:.arx "exit\n"
  76. rename Env:.arx Ram:arx.rexx
  77. wait file Ram:arx.rexx 100
  78. run 'rx Ram:arx.rexx'
  79.